﻿/*******************************************************************************************************************************************
Modification History:
********************************************************************************************************************************************
Date		Author		    Description
********************************************************************************************************************************************
05/08/2011	Brian Kuhn	    Created ISpecification<T> interface
*******************************************************************************************************************************************/
using System;
using System.Linq.Expressions;

namespace Concise
{
    /// <summary>
    /// Describes a generic specification that defines a set of criteria.
    /// </summary>
    /// <typeparam name="T">The type the specification defines a set of criteria for.</typeparam>
    public interface ISpecification<T> : ISpecification
    {
        //=======================================================================================================
        //  Properties
        //=======================================================================================================
        #region Predicate
        /// <summary>
        /// Gets the expression that defines the criteria of the specification.
        /// </summary>
        /// <value>
        /// A <see cref="Expression{TDelegate}"/> that defines the criteria of the specification.
        /// </value>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
        Expression<Func<T, bool>> Predicate
        {
            get;
        }
        #endregion

        //=======================================================================================================
        //  Methods
        //=======================================================================================================
        #region IsSatisfiedBy(T entity)
        /// <summary>
        /// Evaluates the specification against the specified entity.
        /// </summary>
        /// <param name="entity">The instance of type <typeparamref name="T"/> to evaluate the specificaton against.</param>
        /// <returns>
        /// <see langword="true" /> if the specification was satisfied by the <paramref name="entity"/>; otherwise, <see langword="false" />.
        /// </returns>
        bool IsSatisfiedBy(T entity);
        #endregion
    }
}
